package com.jstorm.count.controller.lineReconnaissance;

import com.jstorm.count.dto.CommonExecution;
import com.jstorm.count.dto.ResultDtoUtile;
import com.jstorm.count.pojo.Result;
import com.jstorm.count.service.lineReconnaissance.LineReconnaossanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @ProjectName: springboot-mybatis
 * @Package: com.jstorm.count.controller.network
 * @ClassName: CommonroadController
 * @Description:
 * @Author: Mr_hu
 * @CreateDate: 2018/12/29 10:08
 * ***********************************************************
 * @UpdateUser: Mr_hu
 * @UpdateDate: 2018/12/29 10:08
 * @UpdateRemark: The modified content
 * @Version: 1.0
 * ***********************************************************
 * Copyright: Copyright (c) 2018
 **/
@Controller
@ResponseBody
@RequestMapping("/line/*")
public class LineReconnaossanceController {

    @Autowired
    private LineReconnaossanceService lineReconnaossanceService;

    /**
     * 共路信令数量统计
     * @return
     */
    @RequestMapping("/line-count")
    public ResultDtoUtile LineCount(){
        CommonExecution lineReconnaossanceExecution = lineReconnaossanceService.selectNumber();
        if (lineReconnaossanceExecution == null){
            new ResultDtoUtile(lineReconnaossanceExecution.getCode(),lineReconnaossanceExecution.getMsg());
        }
        //返回成功
        return new ResultDtoUtile(lineReconnaossanceExecution.getCode(),lineReconnaossanceExecution.getMsg(),lineReconnaossanceExecution.getList());

    }


    /**
     * 共路信令数量统计
     * @return
     */
    @RequestMapping("/line-total")
    public ResultDtoUtile LineTotal(){
        //进行service方法查找所有
        CommonExecution lineReconnaossanceTotal = lineReconnaossanceService.selectTotal();
        //返回失败，没有数据，或者出错了
        if (lineReconnaossanceTotal == null){
            new ResultDtoUtile(lineReconnaossanceTotal.getCode(),lineReconnaossanceTotal.getMsg());
        }
        //返回成功
        //返回成功
        return new ResultDtoUtile(lineReconnaossanceTotal.getCode(),lineReconnaossanceTotal.getMsg(),lineReconnaossanceTotal.getList());


    }

}
